package com.juyu.miliao.api.dao.mysql;

import com.juyu.miliao.api.domain.QuestionAndAnswerInfo;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author xuanqicheng
 * @create 2018-17-1:51 PM
 */
@Repository
public class QuestionAndAnswerInfoDao {

    @Autowired
    private SqlSession sqlSession;

    public void createInfo(QuestionAndAnswerInfo questionAndAnswerInfo) {
        sqlSession.insert("addQuestionAndAnswerInfo",questionAndAnswerInfo);
    }

    public void updateInfo(QuestionAndAnswerInfo questionAndAnswerInfo) {
        sqlSession.update("updateInfoQuestionAndAnswerInfo",questionAndAnswerInfo);
    }

    public QuestionAndAnswerInfo selectOne(Long id) {
        return sqlSession.selectOne("selectInfoById",id);
    }

    public List<QuestionAndAnswerInfo> selectVipVoiceList(Map<String, Object> parameterMap) {

        return sqlSession.selectList("selectVipVoiceList",parameterMap);
    }


    /**
     * 查询主播回答过的问题
     * @param parameterMap
     * @return
     */
    public List<QuestionAndAnswerInfo> selectSecretVoiceByAnchorList(Map<String, Object> parameterMap) {
        return sqlSession.selectList("selectSecretVoiceByAnchorList",parameterMap);
    }

    public List<QuestionAndAnswerInfo> selecrSecretVoiceByNotAnchorList(Map<String, Object> parameterMap) {
        return sqlSession.selectList("selecrSecretVoiceByNotAnchorList",parameterMap);
    }

    public List<QuestionAndAnswerInfo> selectListByAnchor(Map<String, Object> parameterMap) {
        return sqlSession.selectList("selectListByAnchor",parameterMap);
    }

    public List<QuestionAndAnswerInfo> selectListByAll(Map<String, Object> parameterMap) {
        return sqlSession.selectList("selectListByAll",parameterMap);
    }

    public QuestionAndAnswerInfo getEntityById(Long id) {
        return sqlSession.selectOne("getQuestionAndAnswerById",id);
    }

    public List<String> selectQualityQuestionAndAnswerIdList() {
        return sqlSession.selectList("selectQualityQuestionAndAnswerIdList");
    }
}
